#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
/*
 * Copyright © 2014, Finium Sdn Bhd, All Rights Reserved
 * 
 * BaseDTO.java
 * Modification History
 * *************************************************************
 * Date				Author						Comment
 * Feb 10, 2012		Venkaiah Chowdary Koneru	Created
 * *************************************************************
 */
package ${package}.dto;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;

import ${package}.enums.OutcomeStatus;
import ${package}.support.JsonDateSerializer;

import org.codehaus.jackson.map.annotate.JsonSerialize;

/**
 * Contains the base level properties like status, errors, createdDate and
 * modifiedDate
 * 
 * @author Venkaiah Chowdary Koneru
 * 
 */
public class BaseDTO implements Serializable
{

    private static final long serialVersionUID = 1L;

    private OutcomeStatus status = OutcomeStatus.SUCCESS;
    private Map<String, String> errors;
    private Date createdDate;
    private Date modifiedDate;
    private long createdDateMs;
    private long modifiedDateMs;

    /**
     * @return returns the created date
     */
    @JsonSerialize(using = JsonDateSerializer.class)
    public Date getCreatedDate()
    {
        return createdDate != null ? new Date(createdDate.getTime()) : null;
    }

    /**
     * @param createdDate
     *            the created date to set
     */
    public void setCreatedDate(Date createdDate)
    {
        if (createdDate != null)
        {
            long ms = createdDate.getTime();
            this.createdDate = new Date(ms);
            setCreatedDateMs(ms);
        }
        else
        {
            this.createdDate = null;
            setCreatedDateMs(0L);
        }
    }

    /**
     * @return returns the modified date
     */
    @JsonSerialize(using = JsonDateSerializer.class)
    public Date getModifiedDate()
    {
        return modifiedDate != null ? new Date(modifiedDate.getTime()) : null;
    }

    /**
     * @param modifiedDate
     *            the modified date to set
     */
    public void setModifiedDate(Date modifiedDate)
    {
        if (modifiedDate != null)
        {
            long ms = modifiedDate.getTime();
            this.modifiedDate = new Date(ms);
            setModifiedDateMs(ms);
        }
        else
        {
            this.modifiedDate = null;
            setModifiedDateMs(0L);
        }
    }

    /**
     * @return returns the status
     */
    public OutcomeStatus getStatus()
    {
        return status;
    }

    /**
     * @param status
     *            the status to set
     */
    public void setStatus(OutcomeStatus status)
    {
        this.status = status;
    }

    /**
     * @return returns the errors
     */
    public Map<String, String> getErrors()
    {
        return errors;
    }

    /**
     * @param errors
     *            the errors to set
     */
    public void setErrors(Map<String, String> errors)
    {
        this.errors = errors;
    }

    /**
     * @return the createdDateMs
     */
    public long getCreatedDateMs()
    {
        return createdDateMs;
    }

    /**
     * @param createdDateMs
     *            the createdDateMs to set
     */
    public void setCreatedDateMs(long createdDateMs)
    {
        this.createdDateMs = createdDateMs;
    }

    /**
     * @return the modifiedDateMs
     */
    public long getModifiedDateMs()
    {
        return modifiedDateMs;
    }

    /**
     * @param modifiedDateMs
     *            the modifiedDateMs to set
     */
    public void setModifiedDateMs(long modifiedDateMs)
    {
        this.modifiedDateMs = modifiedDateMs;
    }
}